package cc.yugu.yhdw.webserver.service.hdw;

import cc.yugu.yhdw.common.domain.hdw.UnregisterBattery;
import cc.yugu.yhdw.common.entity.pagination.Page;
import cc.yugu.yhdw.webserver.persistence.hdw.BatteryMapper;
import cc.yugu.yhdw.webserver.persistence.hdw.UnregisterBatteryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
/**
 * 未注册电池业务
 * 
 * @Date:Created in 2018/7/10 17:24
 * @Author:
 * @Modified By: zjn 2018/7/10 17:24
 */ 
@Service
public class UnregisterBatteryService {
    @Autowired
    UnregisterBatteryMapper unregisterBatteryMapper;
    @Autowired
    BatteryMapper batteryMapper;
    /**
    * 分页查询
    * 
    * @Param: [search]
    * @Return: cc.yugu.yhdw.common.entity.pagination.Page
    * @Author By: zjn 2018/7/10  17:24
    */ 
    public Page findPage(UnregisterBattery search) {
        Page page = search.buildPage();
        page.setTotalItems(unregisterBatteryMapper.findPageCount(search));
        search.setBeginIndex(page.getOffset());
        List<UnregisterBattery> list = unregisterBatteryMapper.findPageResult(search);
        page.setResult(list);
        return page;
    }

    public UnregisterBattery find(String id) {
        return unregisterBatteryMapper.find(id);
    }
}
